import request from '@/utils/request'

//获取分类列表
export function getAllcategory() {
  return request({
    url: 'category/findAll',
    method: 'get'
  })
}


//根据id获取
export function findCategoryById(id) {
  return request({
    url: 'category/findById',
    method: 'get',
    params: {
      id: id
    }
  })
}
//根据parentId获取
export function findCategoryByParentId(parentId) {
  return request({
    url: 'category/findCategoryByParentId',
    method: 'get',
    params: {
      parentId: parentId
    }
  })
}

//删除
export function deleteCategory(id) {
  return request({
    url: 'category/delete',
    method: 'get',
    params: {
      id: id
    }
  })
}

//修改
export function updateCategory(category) {
  return request({
    url: 'category/update',
    method: 'post',
    data: category
  })
}

//插入
export function insertCategory(category) {
  return request({
    url: 'category/insert',
    method: 'post',
    data: category
  })
}
